﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using OnlineHelpDesk.Requestor;
using OnlineHelpDesk.BLL_Service;



namespace OnlineHelpDesk.Requestor
{
    
    public partial class RequestorCreateRequest : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            //Service1 s = new Service1();
            lblRequestStatus.Enabled = false;
            txtUserName.Text = Session["UserName"].ToString();
            lblNameLogin.Text = Session["UserName"].ToString();
            //Service1 s = new Service1();
            //string UserID = s.getUserIDbyUserName(Session["UserName"].ToString());
            //txtTest.Text = UserID;

          
        }

        protected void btnCreate_Click(object sender, EventArgs e)
        {
            DateTime datetime = new DateTime();
            datetime = DateTime.Now.Date;
            Service1 s = new Service1();    

            string RequerstTypeID = ddlRequestType.SelectedValue.ToString();
            string UserName = txtUserName.Text.ToString();
            string UserID = s.getUserIDbyUserName(Session["UserName"].ToString());
            string RequestTitle = txtRequestTitle.Text.ToString();
            string RequestContent = txtRequestContent.Text.ToString();
            string RequestPriority = ddlRequestPriority.SelectedValue.ToString();
            string RequestStatus = lblRequestStatus.Text;
            string RequestDate = datetime.ToString();
            string UserAssignee = "";
            string Remark = "";
            s.addRequest(RequerstTypeID, UserID.ToString(), RequestTitle, RequestContent, RequestPriority, RequestDate, UserAssignee, RequestStatus, Remark);
            Response.Write("<script>alert('Create Request is Finish!!');</script>");
            Response.Redirect("RequestorListRequest.aspx");
        }

        protected void ddlRequestPriority_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        protected void btnReset_Click(object sender, EventArgs e)
        {
            ddlRequestPriority.SelectedValue="Normal";
            ddlRequestType.Text="Lib01";
            txtRequestContent.Text = "";
            txtRequestTitle.Text = "";
            txtRequestTitle.Focus();
        }

  

     



 
    }
}